#include <iostream>
#include <set>
#define LL long long
using namespace std;

set<LL> GetInterestingNumber() {
  set<LL> ret;
  for (int a = 0; a <= 9; a++) {
    for (int b = 0; b <= 9; b++) {
      if (a == b) {
        continue;
      }
      for (int len = 1; len <= 16; len++) {
        for (int p = 0; p <= len; p++) {
          if (b == 0 && p == 0) {
            continue;
          }
          LL tmp = 0;
          for (int l = 0; l <= len; l++) {
            if (l == p) {
              tmp = tmp * 10 + b;
            } else {
              tmp = tmp * 10 + a;
            }
          }
          ret.insert(tmp);
          if (a == 0) {
            break;
          }
        }
      }
    }
  }
  return ret;
}
int main() {
  freopen("odometer.in", "r", stdin);
  freopen("odometer.out", "w", stdout);
  LL X, Y;
  int ans = 0;

  cin >> X >> Y;
  for (const LL t : GetInterestingNumber()) {
    if (X <= t && t <= Y) {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}